extends "res://GameScenes/FunctionPropScene/BaseProp/BaseProp.gd"

func _init() -> void:
	prop_id = "YaoJi"

func _ready() -> void:
	prop_name = "幺鸡"
	self_destruction = false
	self_description = "打出幺鸡后，进行手牌核算时,每有一种牌型便将倍率+3"
	trigger_timing = 2
	detail_label.text = self_description
	hover_detail_label.text = self_description
	if self.get_parent():
		var parent = self.get_parent()
		if parent.name == "PlayerProps":
			detail_label.visible = false
		else:
			detail_label.visible = true

func propFunction(deck,scoreMapping,selectedCardsDetail):
	var parent = self.get_parent()
	var grandParent = parent.get_parent()
	var timer = grandParent.timer
	var selectedMahjongs = grandParent.selectedMahjongs
	var hasTiao_1Flag = false
	for mahjong in selectedMahjongs:
		var mahjongType = mahjong.mahjong_id.split("_")[0] + "_" + mahjong.mahjong_id.split("_")[1]
		if mahjongType == "tiao_1":
			hasTiao_1Flag = true
	if hasTiao_1Flag:
		showRunDetail()
		timer.start() #启动计时器
		await timer.timeout # 等待
		selectedCardsDetail.addMagnification += 3
		hideRunDetail()
